package ar.com.angrymachine.hunter.ui;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;

import ar.com.angrymachine.hunter.Game;
import ar.com.angrymachine.hunter.GraphicStyles;
import ar.com.angrymachine.gameui.Widget;

public class MainWidget extends Widget
{
    ActivityWidget levelActivityPane;
    ActivityWidget userActivityPane;
    StatusBarWidget statusBar;
    LabelWidget mainQuestBar;
    public MainWidget(Rectangle area)
    {
        super(null, area);
        // TODO: hardcoded values
        int statusBarHeight = 150;
        int activitySeparatorOffset = 400;
        mainQuestBar = new LabelWidget(this, new Rectangle(0,0,area.width,25), GraphicStyles.defaultTextBackgroundColor(), GraphicStyles.defaultTextColor());
        levelActivityPane = new MainActivityWidget(this, new Rectangle(0,mainQuestBar.getHeight(),activitySeparatorOffset, area.height - 25)); 
        userActivityPane = new SpellbookActivityWidget(this, new Rectangle(activitySeparatorOffset,statusBarHeight+mainQuestBar.getHeight(),area.width-activitySeparatorOffset, area.height));
        statusBar = new StatusBarWidget(this, new Rectangle(activitySeparatorOffset,mainQuestBar.getHeight(),area.width - activitySeparatorOffset, statusBarHeight));
    }
    
    public void run()
    {
        Game.current.run();
    }
    
    public void paint(Graphics g)
    {
    	g.setColor(Color.BLACK);
    	g.fillRect(0,0,getWidth(),getHeight());        
        // draw separator
        g.setColor(Color.DARK_GRAY);
        g.drawLine(levelActivityPane.getWidth(), 0, levelActivityPane.getWidth(), getHeight());
        g.drawLine(levelActivityPane.getWidth() - 1, 0, levelActivityPane.getWidth() - 1, getHeight());
    }    
}
